/*
 * Copyright (c) 2025 Industrial Software Feature Database
 */
package com.comac.ins.isfd.constant.enums;

import com.comac.ins.common.core.utils.StringUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 *
 * 数据库建模模型展现方式枚举
 * @author lj
 * @date 2025-01-13
 */
@AllArgsConstructor
@Getter
public enum IsfdDatabaseModelShowTypeEnum {
    TREE("tree", "树型"),
    TAG("tag", "标签"),
    TABLE("table", "表格");
    private final String value;
    private final String desc;

    public static String getDescByValue(String value) {
        IsfdDatabaseModelShowTypeEnum isfdAnalysisApplicationTypeEnum = forValue(value);
        if (isfdAnalysisApplicationTypeEnum == null) {
            return null;
        }
        return isfdAnalysisApplicationTypeEnum.getDesc();
    }

    public static IsfdDatabaseModelShowTypeEnum forValue(String value) {
        if (StringUtils.isBlank(value)) {
            return null;
        }
        for (IsfdDatabaseModelShowTypeEnum isfdAnalysisApplicationTypeEnum : IsfdDatabaseModelShowTypeEnum.values()) {
            if (isfdAnalysisApplicationTypeEnum.getValue().equals(value)) {
                return isfdAnalysisApplicationTypeEnum;
            }
        }
        return null;
    }

    public static IsfdDatabaseModelShowTypeEnum forDesc(String desc) {
        if (desc == null) {
            return null;
        }
        for (IsfdDatabaseModelShowTypeEnum isfdAnalysisApplicationTypeEnum : IsfdDatabaseModelShowTypeEnum.values()) {
            if (desc.equals(isfdAnalysisApplicationTypeEnum.getDesc())) {
                return isfdAnalysisApplicationTypeEnum;
            }
        }
        return null;
    }
}
